@using Eksponent.RazorRocks;
@using Eksponent.RazorRocks.Umbraco;
@{        
    RazorRocks.ConfigureTemplates(cfg =>
    {

        //The base path for cshtml files
        cfg.SetBasePath("~/macroScripts/RazorRocks/")

        //If no specific template is found using the document type alias the template named "Default.cshtml" is used
        .Default.Match("Default")

        //If you think it's prettier if this template is called "Frontpage.cshtml" you can add this.                
        //.Types("Site").Match("Frontpage") //Without this line a template called "Site.cshtml" would have been used                       

        
        //Simple template selection for, say, subsites        
         //.Types("Site")
         //   .MatchIf(x => x.GetPropertyString("cssClass") == "main-site", "Frontpage")
         //   .Else.Match("FrontpageSub")
        
         
        //Controller like template selection. You decide if you think it's a good idea :)
        .Types("Site")
            .Match((item, ps) =>
            {
                //You decide if 
                if (HttpContext.Current.Request.HttpMethod == "POST")
                {
                    ps["SomeValue"] = "Test"; // This parameter is available in the FrontpagePosted template
                    return "FrontpagePosted";
                }
                else
                {
                    return "Frontpage";
                }
            })
         
        .ForSubfolders("RazorDelegates").Default

            //If you need to access the parameters parsed to the Render method you can wrap the Razor template in a lambda expression like this
            .Match((ps)=>@<span>@item.Name (@ps.Test)</span>)

            //Otherwise you can just do this
            .Else.Match(@<span>@item.Name</span>)
        

        //This method forces the "Unavailable" template to be used for all document types if they are unavailable
        .AllTypes
            .MatchIf(x => "" + x.GetProperty("unavailable") == "1", "Unavailable")            
            
        //Monitor changes in the RazorRocks folder. Doesn't work in medium trust                
        .MonitorTemplateChanges();
    }, true /* <-- Reload configuration on each request*/);             
}
@RazorRocks.CurrentNode.Render()
